<?php include 'inc/top.php';?>
<?php include 'inc/menu_top.php';?>
<?php include 'inc/boxtop.php';?>
<div id="home">
<?php 
	$sql = "SELECT c.cate_name , c.cate_id , c.cate_link FROM tb_category c  WHERE c.cate_parent_id = '1' ";
	$query = mysql_query($sql);
	while ($data = mysql_fetch_array($query) ){
?>
		<div id="boxcategory" style="height:230px;">
			<div id="title_category">
		    	<div class="cate1"><a href="<?php echo $data["cate_link"]."?cate_id=".$data["cate_id"]?>"><?php echo $data["cate_name"] ?></a></div>
		    </div>
		  	<?php 
		  	$sql_small = "SELECT p.product_id, p.product_name , p.product_price , p.product_info
		  			  FROM tb_product p
		  			  WHERE p.cate_id = '".$data["cate_id"]."' LIMIT 4";
		  	$query_small = mysql_query($sql_small);
		  	while ($data_small = mysql_fetch_array($query_small)){
		  		?>
		  		<div id="boxproduct" style="border-left:none">
			    	<div class="image"><img src="http://themeviet.org/data/theme_tivi.jpg" /></div>
			    	<div class="title" style="height:20px"><a href="product_detail.php?product_id".<?php echo $data_small["product_id"]?>><?php echo $data_small["product_name"]?></a></div>
			    	<div class="price">Giá : <?php echo $data_small["product_price"]?></div>
			    	<div class="price"><input type="button" p_id="<?php echo $data_small["product_id"]?>"  onclick="addToCart(this);" value="Thêm vào giỏ" /></div>
	    		</div>
		  	<?php }	?>
		 </div>  
<?php }?>
		<img id="loader_image" src="style/images/gif/loading_black.gif"  alt="loading...">
			

</div>
<?php include 'inc/sidebar_right.php';?>
<?php include 'inc/bottom.php';?>